const webpack = require('webpack') 
module.exports = {
  webpackConfig: {
    devServer: {

    },

  },
  webpackChain: (chain) => {
    chain.plugin('chunkPlugin').use(webpack.optimize.LimitChunkCountPlugin,[{
      maxChunks: 1,
    }])
    chain.externals(
      {
        'yt-engine': 'yt-engine', 
        'vue': 'vue', 
        'vue-styled-components': 'vue-styled-components', 
        'ant-design-vue': 'ant-design-vue', 
        'echarts': 'echarts', 
        'jquery': 'jquery', 
        'moment': 'moment', 
        'echarts-wordcloud': 'charts-wordcloud',
        'react': 'react',
        'react-dom': 'react-dom'
      }
    )
    chain.module.rule('font')
      .test(/\.woff$|\.ttf$|\.woff2$/)
      .type('asset/inline')
      
    chain.module.rule('picture')
      .test(/\.png$|\.svg$|\.gif$/)
      .type('asset')

    chain.module.rule('file')
      .test(/\.wasm$|\.wsv$/)
      .type('asset')

      ;['.js', '.ts', '.jsx', '.vue', '.less', '.css', '.woff','.ttf','.wasm','.woff2','.wsv', '.png','.svg', '.gif'].forEach(key => {
        chain.resolve.extensions.add(key)
      })
    }
}
